package com.new2i.dao.impl;

import java.util.HashMap;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
   
import com.new2i.dao.able.ScreenSchoolDao; 
import com.new2i.dao.mapper.ScreenSchoolMapper; 
import com.new2i.model.ScreenSchoolEntity; 

/**
 * 筛查学校数据库访问的实现类
 * 
 * @since 2015/09/22
 * @author 2i
 *
 */
@Repository("ScreenSchoolDao")
public class ScreenSchoolDaoImpl implements ScreenSchoolDao{

	@Autowired
	private ScreenSchoolMapper screenSchoolMapper;

	@Override
	public ScreenSchoolEntity insertScreenSchool(ScreenSchoolEntity scSchool) {
		screenSchoolMapper.insertScreenSchool(scSchool);
		return scSchool;
	}

	@Override
	public List<HashMap<String, Object>> selectScreenSchoolList(Integer doctor_id, Integer page) {
		if(page == null || page < 0) 
			page = 1;
		Integer offset = 10; 
		Integer start = (page - 1) * offset;
		return screenSchoolMapper.selectScreenSchoolList(doctor_id, start, offset); 	
	}

	@Override
	public HashMap<String, Object> getScreenSchoolById(Integer sc_school_id) {
		return screenSchoolMapper.getScreenSchoolById(sc_school_id); 
	}

	@Override
	public Integer updateScreenSchool(ScreenSchoolEntity scQuarter) { 
		return screenSchoolMapper.updateScreenSchool(scQuarter); 
	}

	@Override
	public Integer removeScreenSchool(Integer sc_school_id, Integer doctor_id) {
		return screenSchoolMapper.removeScreenSchool(sc_school_id, doctor_id);
	}

	@Override
	public Integer backupScreenSchool(Integer sc_school_id, Integer doctor_id) {
		return screenSchoolMapper.backupScreenSchool(sc_school_id, doctor_id);
	}

	@Override
	public Integer deleteScreenSchool(Integer sc_school_id, Integer doctor_id) {
		return screenSchoolMapper.deleteScreenSchool(sc_school_id, doctor_id);
	}
  
}
